package com.woniuxy.book87.controller;

import com.woniuxy.book87.entity.BookType;
import com.woniuxy.book87.result.Result;
import com.woniuxy.book87.service.BookTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("bookType")
public class BookTypeController {

    @Autowired
    BookTypeService bookTypeService ;

    @GetMapping("/getAll")
    public Result<List<BookType>> getAll(){
        try {
            List<BookType> list = bookTypeService.findAll();
            return Result.ok("查询图书类型成功",list);
        }catch (Exception e) {
            e.printStackTrace();
            return Result.fail("查询图书类型失败!");
        }
    }

}
